import { deepClone, getNormalStorage } from "../../utils/common"
const vx= {
  rule : {
    putAway: getNormalStorage({strKey: 'putaway.taskConfig', defaultValue: {}, type: 'Object'}),
    pick: getNormalStorage({strKey: 'picking.taskConfig', defaultValue: {}, type: 'Object'}),
    stockTake: getNormalStorage({strKey: 'stocktake.taskConfig', defaultValue: {}, type: 'Object'}),
  }
}
export default {
  namespaced: true,
  state: {
    putAwayRule: deepClone(vx.rule.putAway),
    pickRule: deepClone(vx.rule.pick),
    stockTakeRule: deepClone(vx.rule.stockTake),
  },
  mutations: {
    UPDATE_DATA(state, {state_key, ...data}) {
      state[state_key] = data;
    },
    CLEAR_DATA(state, state_key) {
      state[state_key] = deepClone(vx[state_key]);
    },
  },
  actions: {
    changeData({ commit }, data) {
      commit('UPDATE_DATA', data);
    },
    resetData({ commit }, data) {
      commit('CLEAR_DATA', data);
    }
  },
  getters: {
    putAwayRule:state=>state.putAwayRule,
    pickRule:state=>state.pickRule,
    stockTakeRule:state=>state.stockTakeRule,
  }
}

